import 'package:bottom_sheet_flutter/utils/color_util/color_util.dart';
import 'package:bottom_sheet_flutter/utils/style_util/style_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import '../../widgets/text_widget/text_widget.dart';
import 'gold_coins_give_bottom_sheet.dart';
import 'package:get/get.dart';

/// @className : gold_coins_give
/// @date 2022/07/17 14:48
/// @author : xiaohai
/// @description : 金币赠送

class GoldCoinsGive extends StatefulWidget {
  const GoldCoinsGive({Key? key}) : super(key: key);

  @override
  _GoldCoinsGiveState createState() => _GoldCoinsGiveState();
}

class _GoldCoinsGiveState extends State<GoldCoinsGive> {
  //对方账户id
  RxString? userId = "".obs;

  //赠送数量
  RxString? giveNumber = "".obs;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("金币赠送"),
        actions: [
          Container(
              //decoration: BoxDecoration(color: Colors.red),
              padding: EdgeInsets.only(left: 24.w, right: 24.w),
              alignment: Alignment.center,
              child: InkWell(
                  onTap: () {
                    showBottomSheetEvent();
                  },
                  child: textWidget("赠送", TS_FFFFFF_34_W4)))
        ],
      ),
      body: Obx(() => Container(
            padding: EdgeInsets.only(left: 80.w),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(height: 300.w),
                Container(child: textWidget("对方账户ID:$userId", TS_333333_32_W5)),
                SizedBox(height: 20.w),
                Container(
                  child: textWidget("赠送数量:$giveNumber", TS_333333_32_W5),
                )
              ],
            ),
          )),
    );
  }

  /// 显示金币赠送抽屉层
  void showBottomSheetEvent() {
    Get.bottomSheet(
      GoldCoinsGiveBottomSheetView(
        userId: userId,
        giveNumber: giveNumber,
        giveClick: (String? userIdStr, String? giveNumbers) {
          /// 点击赠送事件
          userId!.value = userIdStr!;
          giveNumber!.value = giveNumbers!;
        },
      ),
      //背景颜色
      backgroundColor: ColorsUtil.hexColor(0xFFFFFF),
      //边框形状
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(32.w),
          topRight: Radius.circular(32.w),
        ),
      ),
      //是否支持全屏弹出，默认false
      isScrollControlled: true,
    );
  }
}
